package com.net;

import com.bean.BannerBean;
import com.bean.BaseBean;
import com.bean.HomeArticleList;
import com.bean.LoginBean;
import com.bean.SearchHotKeyBean;
import com.bean.SearchListBean;
import com.bean.ToDoBean;
import com.bean.WxArticleAuthorBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

public interface ApiService {
    @GET("article/list/{page}/json")
    Observable<BaseBean<HomeArticleList>> getHomeArticleList(@Path("page") int page);

    @GET("banner/json")
    Observable<BaseBean<List<BannerBean>>> getHomeBannerList();

    @GET("hotkey/json")
    Observable<BaseBean<List<SearchHotKeyBean>>> getHotKeyList();

    @POST("article/query/{page}/json")
    @FormUrlEncoded
    Observable<BaseBean<SearchListBean>> getSearchList(@Path("page") int page, @Field("k") String keyWord);

    /**
     * 公众号作者列表
     *
     * @return
     */
    @GET("wxarticle/chapters/json")
    Observable<BaseBean<List<WxArticleAuthorBean>>> getWxAuthorList();

    /**
     * 公众号文章列表
     *
     * @return
     */
    @GET("wxarticle/list/{id}/{page}/json")
    Observable<BaseBean<SearchListBean>> getWxArticleList(@Path("id") int id, @Path("page") int page);

    /**
     * 登陆接口
     *
     * @param username 账号
     * @param password 密码
     * @return
     */
    @POST("user/login")
    @FormUrlEncoded
    Observable<BaseBean<LoginBean>> login(@Field("username") String username, @Field("password") String password);


    /**
     * 注销
     *
     * @return
     */
    @GET("user/logout/json")
    Observable<BaseBean> logout();

    /**
     * 账号注册
     *
     * @param username
     * @param password
     * @param repassword
     * @return
     */
    @POST("user/register")
    @FormUrlEncoded
    Observable<BaseBean<LoginBean>> register(@Field("username") String username, @Field("password") String password, @Field("repassword") String repassword);



    /**
     * todo列表
     *
     * @param status 状态， 1-完成；0未完成; 默认全部展示；
     * @param type   创建时传入的类型, 默认全部展示
     * @return
     */
    @POST("lg/todo/v2/list/{page}/json")
    @FormUrlEncoded
    Observable<BaseBean<ToDoBean>> getToDoList(@Field("status") int status, @Field("type") int type, @Path("page") int page);
}
